package com.oocl.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import com.oocl.pojo.Customer;
import com.oocl.service.CustomerManager;

public class CustomerManagerImpl implements CustomerManager{
	private List<Customer> customers = new ArrayList<>();
	
	public CustomerManagerImpl() {
		Customer c1 = new Customer(UUID.randomUUID().toString(), "Kelvin", true, 333.45, new Date());
		Customer c2 = new Customer(UUID.randomUUID().toString(), "Jack", true, 777.25, new Date());
		Customer c3 = new Customer(UUID.randomUUID().toString(), "Lisa", false, 555.45, new Date());
		customers.add(c1);
		customers.add(c2);
		customers.add(c3);
	}

	@Override
	public synchronized Customer addCustomer(Customer customer) {
		customer.setId(UUID.randomUUID().toString());
		customers.add(customer);
		return customer;
	}

	@Override
	public List<Customer> findAll() {
		return customers;
	}
	
}
